<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<meta name="Generator" content="EditPlus®">
		<meta name="Author" content="梦想星辰大海">
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		<title>cms后台模板</title>
		<link rel="stylesheet" href="${BASE_PATH}/static/book/res/lib/layui/css/layui.css">
	</head>
	<body>
		<form class="layui-form" action="edit.htm" method="post" role="form">
			<input type="hidden" name="id" value="${book.bookId}" />
			<div class="layui-form-item">
		        <label for="number" class="layui-form-label">图书编号:</label>
				<div class="layui-input-block">
					 <input type="text" name="title" value="${book.number}" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
	    		</div>
    		</div>
    		<div class="layui-form-item">
		        <label for="urlPic" class="layui-form-label">图片:</label>
				<div class="layui-input-inline">
					<img src="${book.urlPic}" />
				</div>
    		</div>
    		<div class="layui-form-item">
		    	<label for="name" class="layui-form-label">书名:</label>
		    	<div class="layui-input-block">
		    		<input type="text" name="title" value="${book.name}" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
	    		</div>
		    </div>
		    <div class="layui-form-item">
		    	<label for="author" class="layui-form-label">作者:</label>
		    	<div class="layui-input-block">
		    		<input type="text" name="title" value="${book.author}" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
	    		</div>
		    </div>
		    <div class="layui-form-item">
		    	<label for="press" class="layui-form-label">出版社:</label>
		    	<div class="layui-input-block">
		    		<input type="text" name="title" value="${book.press}" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
	    		</div>
		    </div>
		    <div class="layui-form-item">
		    	<label for="press" class="layui-form-label">出入库:</label>
		    	<div class="layui-input-item">
		      		<div class="layui-input-inline">
			        	<input type="text" name="quantity" autocomplete="off" placeholder="正数添加负数减少" class="layui-input">
			      	</div>
	    		</div>
		    </div>
			<div class="layui-form-item" style="float: right; margin-right: 100px;">
			    <button class="layui-btn" lay-submit="" lay-filter="ff">修改</button>
			    <a href="index.htm" type="submit" class="layui-btn">返回</a>
	 		</div>
 		</form>
	</body>
	<script type="text/javascript" src="${BASE_PATH}/static/book/res/lib/layui/layui.js"></script>
	<script>
	layui.use(['form', 'layedit', 'laydate','jquery'], function(){
	  var form = layui.form()
	  ,layer = layui.layer
	  ,$ = layui.jquery;
	  
	 
	  //自定义验证规则
	  form.verify({
	    title: function(value){
	      if(value.length <1){
	        return '标题不能为空';
	      }
	    }
	  });
	  
	  //监听提交
		form.on('submit(ff)', function(data) {
			$.ajax({
				url:"editQuantity.json",
				type:"post",
				data:data.field,
				success:function(res){
					if(res.result){
						alert("修改成功")
						location.reload(); 
					}
				}
			})
			return false;
		});
	});

	//上传图片
	layui.use('upload', function(){
	layui.upload({
	    url: '' //上传接口
	    ,success: function(res){ //上传成功后的回调
	      console.log(res)
	    }
	});
	    1
	layui.upload({
	    url: '/test/upload.json'
	    ,elem: '#test' //指定原始元素，默认直接查找class="layui-upload-file"
	    ,method: 'get' //上传接口的http类型
	    ,success: function(res){
	      LAY_demo_upload.src = res.url;
	    }
	});
});
</script>
</html>
